#@layout()

#define script()
<script>

    function doDel(id) {
        ajaxGet("/admin/interact/jpress_addon_interact/doDel/" + id);
    }

    $("#batchDel").click(function () {
        var ids = getSelectedIds();
        if (ids == "") {
            alert('您未选择任何条目');
            return
        }
        ajaxGet("/admin/interact/jpress_addon_interact/doDelByIds?ids=" + ids);
    })

    function reset(){
        window.location.href = window.location.pathname;
    }

</script>
#end

#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
            管理
            <small>Items</small>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">

                    <form class="form-horizontal actionPanel" method="get">
                        <div class="row">
                            <div class="form-group col-lg-4">
                                <label class="col-sm-3 control-label">用户</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" name="nickname" value="#para('nickname')">
                                </div>
                            </div>
                            <div class="form-group col-lg-4">
                                <label class="col-sm-3 control-label">标题</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" name="title" value="#para('title')">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group col-lg-4">
                                <label class="col-sm-4 control-label">最后互动时间</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control datetimepicker" name="startTime" value="#para('startTime')">
                                </div>
                            </div>
                            <div class="form-group col-lg-4">
                                <label class="col-sm-4 control-label">至</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control datetimepicker" name="endTime" value="#para('endTime')">
                                </div>
                            </div>
                            <div class="form-group col-lg-4">
                                <div class="col-sm-12">
                                    <button type="submit" class="btn btn-primary ">查询</button>
                                    <a href="javascript:reset();"><button type="button" class="btn btn-default">刷新</button></a>
                                </div>
                            </div>
                        </div>

                        <!-- /.box-body -->
                    </form>

                    <div class="box-header with-border">

                        <div class="row actionPanel">
                            <div class="col-xs-12">
                                <a href="jpress_addon_interact/edit" class="btn btn-primary ">
                                    <i class="fa fa-fw fa-plus"></i> 新建
                                </a>
                                <button type="submit" id="batchDel" class="btn btn-default checkAction"> 批量删除</button>
                            </div>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body ">

                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <th style="width: 10px">
	                                    <input name="dataItem" onchange="checkAll(this)" type="checkbox"/>
                                </th>
                                <th>id</th>
                                <th>用户</th>
                                <th>姓名</th>
                                <th>电话</th>
                                <th>邮箱</th>
                                <th>标题</th>
                                <th>附件</th>
                                <th>最后互动时间</th>
                            </tr>
                            #for(entry : page.list)
                            <tr class="jp-actiontr">
                                <td><input class="dataItem" type="checkbox" value="#(entry.id)" />
                                </td>
                                <td>
                                    <strong>
                                        <a href="#(CPATH)/admin/interact/jpress_addon_interact/edit/#(entry.id)"> #(entry.id ??) </a>
                                    </strong>
                                    <div class="jp-actionblock">
                                        <div class="jp-actionitem">
                                            <a href="/admin/interact/jpress_addon_interact/answer/#(entry.id)">解答</a> |
                                            <a href="/admin/interact/jpress_addon_interact/comment?interactid=#(entry.id)">查看解答列表</a> |
                                            <a href="/admin/interact/jpress_addon_interact/edit/#(entry.id)">编辑</a> |
                                            <a href="javascript:;" class="red-action" onclick="doDel('#(entry.id)')">删除</a>
                                        </div>
                                    </div>
                                </td>
                                <td>#(entry.user.nickname)</td>
                                <td>#(entry.name ??)</td>
                                <td>#(entry.phone_number ??)</td>
                                <td>#(entry.email ??)</td>
                                <td>#(entry.title ??)</td>
                                <td>
                                    #if(entry.attachment ??)
                                    <a href="#(entry.attachment ??)">下载附件</a>
                                    #else
                                    无附件
                                    #end
                                </td>
                                <td>#(entry.create_time)</td>
                            </tr>
                            #end
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <div class="row">
                            <div class="col-sm-12">
                            	 #@_paginate()
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.box -->
            </div>
        </div>

    </section>
</div>
#end
